/**
 * Definition for singly-linked list.
 * function ListNode(val, next) {
 *     this.val = (val===undefined ? 0 : val)
 *     this.next = (next===undefined ? null : next)
 * }
 */
/**
 * @param {ListNode} head
 * @param {number} x
 * @return {ListNode}
 * 输入：head = [1,4,3,2,5,2], x = 3
输出：[1,2,2,4,3,5]
 */
const createListNode = arr => {
  function ListNode(val, next) {
    this.val = val === undefined ? 0 : val
    this.next = next === undefined ? null : next
  }
  let oldListNode = null
  for (let index = arr.length - 1; index > -1; index--) {
    const val = arr[index]
    const newListNode = new ListNode(val, oldListNode)
    oldListNode = newListNode
  }
  return oldListNode
}
var partition = function (head, x) {
    
}
